﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>Demo:待办</title>

    <!-- 引入常用的JS脚本. -->
    <script src="../WF/Scripts/QueryString.js"></script>
    <script src="../WF/Scripts/jquery/jquery.min.js" type="text/javascript"></script>
    <script src="../WF/Scripts/jquery/jquery.cookie.js" type="text/javascript"></script>
    <link href="../WF/Scripts/bootstrap/css/bootstrap.css" rel="stylesheet" />
    <link href="skin/css/style.css" rel="stylesheet" type="text/css" />
    <link href="skin/css/animate.css" rel="stylesheet" type="text/css" />

    <!-- 引入ccbpm 的sdk开发js.  -->
    <script src="../WF/config.js" type="text/javascript"></script>
    <script src="Dev2Interface.js"></script>
    <script language="javascript" type="text/javascript">

        //启动函数
        $(function () {

            $("#docs").html("<img src=./Img/loading.gif />&nbsp;正在加载,请稍后......");
            // ccbpmHostDevelopAPI 变量是定义在 /config.js 的服务地址. 访问必须两个参数DoWhat,SID.
            // dowhat 就是一个请求的标记, sid 类似于token，登录的时候写入到 表Port_Emp的SID列的值.
            //获得当前的SID.
            var sid = $.cookie("MySID");

            //调用 /WF/Dev2Interface.js 的 DB_Todolist 接口，获得当前人员的待办列表.
            var db = DB_Draft();
            // db = JSON.parse(db);
            var html = "<table class='table table-striped table-bordered table-hover'>";
            html += "<tr>";
            html += "<th>#</th>";
            //html += "<th>WorkID</th>";
            html += "<th>标题</th>";
            html += "<th>流程</th>";
            html += "<th>日期</th>";
            html += "<th>操作</th>";
            html += "</tr>";

            for (var i = 0; i < db.length; i++) {
                var en = db[i];
                html += "<tr>";
                html += "<td>" + (i + 1) + "</td>"; //序号

                html += "<td><a href=\"javascript:OpenForm('" + en.FK_Flow + "','" + en.FK_Node + "','" + en.WorkID + "','" + en.FID + "');\" >" + en.Title + "</a></td>";

                //  html += "<td>" + en.FK_Flow + "</td>"; //流程编号.
                html += "<td>" + en.FlowName + "</td>"; //流程名称.

                html += "<td>" + en.RDT + "</td>"; //发起日期.

                html += "<td><a href=\"javascript:Delete('" + en.WorkID + "')\" >删除</a></td>"; //发起日期.
                html += "</tr>";
            }
            html += "</table>";
            $("#docs").html(html);
        });

        function Delete(workid) {
            if (window.confirm("您确定要删除吗？") == false)
                return;

            //调用  Dev2Interface.js 接口删除草稿.
            Flow_DeleteDraft(workid);
        }
    </script>
</head>
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <!--<div id="title" style="font-family:'Microsoft YaHei';font-size:24px;margin:3px;">草稿</div>-->
        <div id="docs" class="ibox-content"></div>
    </div>

</body>
</html>